//
//  NewsTableViewCell.m
//  NetEase
//
//  Created by Apple on 2018/5/5.
//  Copyright © 2018年 techbird. All rights reserved.
//

#import "NewsTableViewCell.h"
#import "NewsModel.h"
#import "YYWebImage.h"

@interface NewsTableViewCell()

@end

@implementation NewsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setNewsModel:(NewsModel *)newsModel{
    _newsModel = newsModel;
    self.titleLabel.text = newsModel.title;
    [self.imgsrcImageView yy_setImageWithURL:[NSURL URLWithString:newsModel.imgsrc] placeholder:[UIImage imageNamed:@"placeholderImage"]];
    self.sourceLabel.text = newsModel.source;
    self.replycountLabel.text = newsModel.replyCount.stringValue;
    
    if (newsModel.imgextra.count>0){
        for (NSUInteger i = 0; i<self.imgsrcImageViews.count; i++) {
            UIImageView *imageView = self.imgsrcImageViews[i];
            NSDictionary *imgDic = newsModel.imgextra[i];
            NSURL *URLString = [NSURL URLWithString:imgDic[@"imgsrc"]];
            [imageView yy_setImageWithURL:URLString placeholder:[UIImage imageNamed:@"placeholderImage"]];
        }
    }
}

@end
